//
//  DataStore.m
//  BaoGongBao
//
//  Created by User on 14/11/8.
//  Copyright (c) 2014年 irule. All rights reserved.
//

#import "DataStore.h"

DataStore				*gDataStore = nil;
//KeychainItemWrapper		*gwrapper = nil;

//AdvertImgUrl = "<null>";
//AdvertValidityFrom = "<null>";
//AdvertValidityTo = "<null>";
//Menu =     (
//);
//Message = "\U767b\U5f55\U6210\U529f";
//Tag = 1;
//Token = d37eaaad99694cbdaa26ef99be859a4f;
//User =     {
//	AppId = "<null>";
//	Burks = "<null>";
//	LastLoginDate = "2014-11-25 11:52:26";
//	LastLoginEqmId = 860955020541003;
//	LastLoginPlace = "";
//	MobileNum = "<null>";
//	RealName = "\U7ae0\U589e\U8f89";
//	Remark = "<null>";
//	Sex = "<null>";
//	UserName = zhangzenghui;
//	UserNum = zhangzenghui;
//};
NSDictionary			*gUserInfo = nil;
NSString				*gloginplace = nil;
NSString				*gToken = nil;

@implementation DataStore

static DataStore *_sharedDataStore = nil;

+ (DataStore *)sharedDataStore
{
	if (!_sharedDataStore)
	{
		_sharedDataStore = [[self alloc] init];
	}

	return _sharedDataStore;
}

- (instancetype)init
{
	self = [super init];
	if (self)
	{

	}
	return self;
}

#pragma mark mbIsInit
- (BOOL)mbIsInit
{
	NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
	return [ud boolForKey:kDataStore_mbIsInit];
}

- (void)setMbIsInit:(BOOL)mbIsInit
{
	NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
	[ud setBool:mbIsInit forKey:kDataStore_mbIsInit];

	[ud synchronize];
}

#pragma mark mbIsLogin
- (BOOL)mbIsLogin
{
	NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
	return [ud boolForKey:kDataStore_mbIsLogin];
}

- (void)setMbIsLogin:(BOOL)mbIsLogin
{
	NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
	[ud setBool:mbIsLogin forKey:kDataStore_mbIsLogin];

	[ud synchronize];
}

- (NSUInteger)mStartPageType
{

	NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
	return [ud integerForKey:kDataStore_mStartPageType];
}

- (void)setMStartPageType:(NSUInteger)mStartPageType
{

	NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
	[ud setInteger:mStartPageType forKey:kDataStore_mStartPageType];

	[ud synchronize];
}

#pragma mark mstrUserName
- (NSString *)mstrUserName
{
	NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
	return [ud objectForKey:kDataStore_mstrUserName];

}
- (void)setMstrUserName:(NSString *)mstrUserName
{

	NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
	[ud setObject:mstrUserName forKey:kDataStore_mstrUserName];

	[ud synchronize];
}

#pragma mark mstrRealName
- (NSString *)mstrRealName
{
	NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
	return [ud objectForKey:kDataStore_mstrRealName];

}

- (void)setMstrRealName:(NSString *)mstrRealName
{
	NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
	[ud setObject:mstrRealName forKey:kDataStore_mstrRealName];

	[ud synchronize];
}

//#pragma mark mstrToken
//- (NSString *)mstrToken
//{
//
//	NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
//	return [ud objectForKey:kDataStore_mstrToken];
//}
//
//- (void)setMstrToken:(NSString *)mstrToken
//{
//
//	NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
//	[ud setObject:mstrToken forKey:kDataStore_mstrToken];
//
//	[ud synchronize];
//}

#pragma mark mstrMobile
- (NSString *)mstrMobile
{

	NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
	return [ud objectForKey:kDataStore_mstrMobile];
}

- (void)setMstrMobile:(NSString *)mstrMobile
{

	NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
	[ud setObject:mstrMobile forKey:kDataStore_mstrMobile];

	[ud synchronize];
}

@end
